<?php

use Faker\Generator as Faker;

/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| This directory should contain each of the model factory definitions for
| your application. Factories provide a convenient way to generateUrl new
| model instances for testing / seeding your application's database.
|
*/

/** @var \Illuminate\Database\Eloquent\Factory $factory */
$factory->define(\App\Models\Store\Store::class, function (Faker $faker) {
    $name = $faker->name;

    return [
        'customer_id'   => 0,
        'name'          => $name,
        'email'         => $faker->unique()->safeEmail,
        'type'          => 1, // 总店铺
        'is_deleted'    => 0,
    ];
});

$factory->state(\App\Models\Store\Store::class, 'with_customer', function () {
    return [
        'customer_id'   => function () {
            return factory(\App\Models\Customer\Customer::class)->create()->id;
        },
    ];
});